<template>
  <div class="modal-bg" v-show="isOpen" @click="test">
    查看图片
  </div>
</template>

<script>
export default {
  name: 'PicView',
  props: {
    isOpen: {
      type: Boolean,
      required: true,
      default: false
    }
  },
  methods: {
    test() {
      this.isOpen = false;
      console.log('OK!')
    }
  },
}
</script>

<style lang="css" scoped>
.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
  z-index: 10;
}
</style>